----------------------------
-- Simplistic Street
-- by Jammie Dodger
--
-- Project Started - October 20, 2009
-- Completion -None
----------------------------

SS = {}
SS.Build = 1.72

GM.Name		= "Simplistic Street"
GM.Author 	= "Jammie Dodger"
GM.Email 	= ""
GM.Website 	= ""

DeriveGamemode( "Sandbox" )

team.SetUp (1, "Citizen", Color ( 20, 150, 20, 255))
team.SetUp (2, "City Official", Color (0, 0, 255, 255))
team.SetUp (3, "Builder", Color ( 0, 0, 255, 255 ))

function SS.Msg(Text)
	Msg("Simplistic Street (Build: "..SS.Build..") - ", Text.."\n")
end

function SS.LoadDirectory(Directory)
	SS.Msg("Loading Directory: "..Directory.."'s Files...")
	if SERVER then
		for k, File in pairs(file.FindInLua(GM.FolderName.."/gamemode".."/"..Directory.."/*.lua")) do
			SS.Msg("Loading "..File..":")
			include(Directory.."/"..File)
		end
	else
		for k, File in pairs(file.FindInLua(GM.FolderName.."/gamemode".."/"..Directory.."/*.lua")) do
			SS.Msg("Loading "..File..":")
			include(Directory.."/"..File)
		end
	end
	SS.Msg("Directory: "..Directory.." Loaded Successfully\n")
end

function SS.AddCSLuaDirectory(Directory)
	SS.Msg("AddCSLuaDirectory: "..Directory.."...")
	for k, File in pairs(file.FindInLua(GM.FolderName.."/gamemode".."/"..Directory.."/*.lua")) do
		SS.Msg("AddCSLuaFile "..File..":")
		AddCSLuaFile(Directory.."/"..File)
	end
	SS.Msg("AddCSLuaDirectory: "..Directory.." - Successful\n")
end

--[[function SS.ProcessFolder(Directory)
	SS.Msg("Resourcing content folder...")
	for k,v in pairs(file.Find(Directory.."*")) do
		if file.IsDir(Directory..v) then
			SS.ProcessFolder(Directory..v.."/")
		else
			local DirectoryLocation = string.gsub(Directory..v,"../gamemodes/SimplisticStreet2/content/","")
			if !(string.find(DirectoryLocation,"bz2") or string.find(DirectoryLocation,"7z") or string.find(DirectoryLocation,"exe") or string.find(DirectoryLocation,"bat") or string.find(DirectoryLocation,"jpg") or string.find(DirectoryLocation,"db")) then
				resource.AddFile(DirectoryLocation)
				SS.Msg("Resourcing content folder: Successful\n")
			end
		end
	end
end--]]

function ResourceMaterials(Folders)
	for k, v in pairs( file.Find("../gamemodes/"..GM.FolderName.."/content/materials/"..Folders.."/*") ) do
		if !file.IsDir("../gamemodes/"..GM.FolderName.."/content/materials/"..Folders.."/"..v) then
			resource.AddFile("materials/"..Folders.."/"..v)
			SS.Msg("Resourcing: materials/"..Folders.."/"..v)
		end
	end
	SS.Msg("Resourcing directory: materials/"..Folders.." - Successful\n")
end

function ResourceModels(Folders)
	for k, v in pairs( file.Find("../gamemodes/"..GM.FolderName.."/content/models/"..Folders.."/*") ) do
		if !file.IsDir(v) then
			resource.AddFile("models/"..Folders.."/"..v)
			SS.Msg("Resourcing: models/"..Folders.."/"..v)
		end
	end
	SS.Msg("Resourcing directory: models/"..Folders.." - Successful\n")
end

function ResourceSounds(Folders)
	for k, v in pairs( file.Find("../gamemodes/"..GM.FolderName.."/content/sound/"..Folders.."/*") ) do
		if !file.IsDir("../gamemodes/"..GM.FolderName.."/content/sound/"..Folders.."/"..v) then
			resource.AddFile("sound/"..Folders.."/"..v)
			SS.Msg("Resourcing: sound/"..Folders.."/"..v)
		end
	end
	SS.Msg("Resourcing directory: sound/"..Folders.." - Successful\n")
end

function _R.Player:IsModerator()
	return self:IsUserGroup("moderator")
end

SS.LoadDirectory("Shared")
SS.AddCSLuaDirectory("Shared")